#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define mk make_pair
#define pii pair<int,int>
#define endl '\n'
#define debug(x) cout<<#x<<':'<<x<<endl
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
const int N=1e6+5,INF=2e9,V=1e6;
int n;
multiset<pii> o;
multiset<int> lt[N],rt[N];
#define ls p<<1
#define rs p<<1|1
struct node{
    int l,r,ans;
    node(){ l=-INF,r=INF,ans=INF; }
}tree[N<<2];
void push_up(int p){
    tree[p].l=max(tree[ls].l,tree[rs].l);
    tree[p].r=min(tree[ls].r,tree[rs].r);
    tree[p].ans=min(tree[rs].r-tree[ls].l+1,min(tree[ls].ans,tree[rs].ans));
}
void modify(int p,int l,int r,int x){
    if(l==r){
        tree[p].ans=INF;
        tree[p].l=lt[x].size()?(*lt[x].rbegin()):-INF;
        tree[p].r=rt[x].size()?(*rt[x].begin()):INF;
        return;
    }
    int mid=(l+r)>>1;
    if(x<=mid) modify(ls,l,mid,x);
    else modify(rs,mid+1,r,x);
    push_up(p);
}
signed main(){
    freopen("stone.in","r",stdin);
    freopen("stone.out","w",stdout);
    IOS;
    cin>>n;
    char op;
    for(int i=1,l,r;i<=n;i++){
        cin>>op>>l>>r,r--;
        if(op=='A') lt[r].insert(l),rt[l].insert(r),o.insert(mk(l,r));
        else lt[r].erase(l),rt[l].erase(r),o.erase(mk(l,r));
        modify(1,1,V,l),modify(1,1,V,r);
        if(tree[1].ans<=V) cout<<tree[1].ans<<endl;
        else{
            int lans=-INF,rans=INF;
            for(pii x:o) lans=max(lans,x.fi),rans=min(rans,x.se);
            cout<<(*rt[lans].begin())-(*lt[rans].rbegin())+1<<endl;
        }
    }
    return 0;
}
/*

5
A 1 5
A 2 7
A 4 6
A 6 8
R 4 6
2 
A 1 3
A 3 4
*/